<template>
    <div>
        <van-icon class="success" name="success" />
        <h5>绑定成功！</h5>
        <h5>{{time}}秒后返回首页</h5>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                time: 5,
                timer:null
            }
        },
        created(){
            this.countdown();
        },
        methods: {
            countdown() {
                var that = this;
                this.timer = setInterval(function(){
                    console.log(that.time)
                    that.time = that.time-1;
                    if(that.time==1)
                    {
                        clearInterval(that.timer);
                        that.$router.replace('/');
                    }
                },1000)
            }
        },
    }
</script>

<style scoped>
.success{
    border: 1px solid rgb(65, 202, 110);
    padding: 10px;
    border-radius: 50%;
    color: rgb(65, 202, 110);
    margin-top: 20%;
}
h5{
    margin: 10px auto;
    text-align: center;
    font-size: 16px;
}

</style>